package chp06.homework;

import java.util.Scanner;

public class Home8b {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("请选择游戏类型:");
        System.out.println("1.牌类");
        System.out.println("2.休闲竞技类");
        System.out.print("请选择:");
        int choose = input.nextInt();
        System.out.print("请输入游戏时长:");
        int hour = input.nextInt();

        //游戏类型
        String name = "";
        //每小时单价
        int danjia = 0;
        if(choose == 1){
            danjia = 10;
            name = "牌类";
        }else if(choose == 2){
            danjia = 20;
            name = "休闲竞技类";
        }

        //折扣
        double discount = 1;
        if(hour >= 10){
            discount = 0.5;
        }else{
            discount = 0.8;
        }

        //总花费 = 单价 * 时长 * 折扣
        int total = (int) (danjia * hour * discount);
        System.out.println("您玩的是"+name+"游戏，时长:"+hour+"小时，可以享受"+discount*10+"折优惠");
        System.out.println("总花费:"+total);
    }
}
